export class Dimension {
  #width: number;
  #height: number;

  get width(): number {
    return this.#width;
  }

  private set width(value: number) {
    if (value < 0) {
      throw new Error('Width must be greater than or equal to zero');
    }

    this.#width = value;
  }

  get height(): number {
    return this.#height;
  }

  private set height(value: number) {
    if (value < 0) {
      throw new Error('Height must be greater than or equal to zero');
    }

    this.#height = value;
  }

  constructor(width: number, height: number) {
    this.width = width;
    this.height = height;
  }

  equal(dimension: Dimension): boolean {
    return this.width === dimension.width && this.height === dimension.height;
  }
}
